<template>
	<view class="conent-box">
		<view class="head-box-back" @tap="back()">
			<view class="common margin-box">
				<image src="../../../static/jingjie/return_h.png"></image>
				<view class="return-title">返回</view>
			</view>
		</view>
		<view class="" v-if="isdongtai">
			<view class="conent-big-box">
				<view class="one-box">
					<view class="head-box">{{dongtaiDetails.content}}？</view>

					<view class="user-box">
						<view class="user-img-box">
							<image :src="user.avatar"></image>
						</view>
						<view class="user_new-box">
							<view class="user_nickName">{{user.nick_name}}</view>
							<view class="money">{{time}}</view>
						</view>
					</view>
					<view class="describe-big-box">
						<view v-for="(item,index) in detailsData.imgArr" :key="index">
							<image v-if="item.imgName" @tap.stop="previewImg(item.imgName,index)" mode="aspectFill" class="describe-img"
							 :src="item.imgName" @longpress="savePicture(item.imgName)" @error="imgError(index)"></image>
							<view v-if="item.content" class="describe-wenzi" v-text="item.content"></view>
						</view>
					</view>

					<view class="like-big-box" @tap.stop="changedianzan">
						<view class="like-box" v-if="like">
							<image src="../../../static/jingjie/dianzan_r.png"></image>
							<text class="like-num-bottom dianzan">{{dongtaiDetails.like_count}}</text>
						</view>
						<view class="like-box" v-else>
							<image src="../../../static/jingjie/dianzan_h.png"></image>
							<text class="like-num-bottom">{{dongtaiDetails.like_count}}</text>
						</view>
					</view>

				</view>
			</view>
		</view>
		<view class="" v-else>
			<view class="conent-big-box">
				<view class="one-box">
					<view class="head-box">{{detailsData.title}}？</view>
					<view class="from-box">
						<text class="from-box-title">#谁有搞笑内容发布看看？#</text>
					</view>
					<view class="user-box" @tap="toUserDetail(user.user_id)">
						<view class="user-img-box">
							<image :src="user.avatar"></image>
						</view>
						<view class="user_new-box">
							<view class="user_nickName">{{user.nick_name}}</view>
							<view class="money">{{time}}</view>
						</view>
					</view>
					<view class="describe-big-box">
						<view v-for="(item,index) in detailsData.imgArr" :key="index">
							<image v-if="item.imgName" @tap.stop="previewImg(item.imgName,index)" mode="aspectFill" class="describe-img"
							 :src="item.imgName" @longpress="savePicture(item.imgName)" @error="imgError(index)"></image>
							<view v-if="item.content" class="describe-wenzi" v-text="item.content"></view>
						</view>
					</view>

					<view class="like-big-box" @tap.stop="changedianzan">
						<view class="like-box" v-if="like">
							<image src="../../../static/jingjie/dianzan_r.png"></image>
							<text class="like-num-bottom dianzan">{{detailsData.like_count}}</text>
						</view>
						<view class="like-box" v-else>
							<image src="../../../static/jingjie/dianzan_h.png"></image>
							<text class="like-num-bottom">{{detailsData.like_count}}</text>
						</view>
					</view>

				</view>
			</view>
		</view>
		<!--好奇回应和一级评论-->
		<view class="bianju">
			<view class="comment-box" v-show="nullComment==false">
				<view class="comment">
					<view class="hot-comment">热门评论</view>
					<view class="">
						<view class="comment-conent-box yi" v-for="(item,index) in hotCommentList" :key="index">
							<view class="first-level-comment">
								<image class="user-img" :src="item.map.userinfo.avatar"></image>
								<view class="comment-box-big">
									<view class="left-box">
										<view class="user-nickName">{{item.map.userinfo.nick_name}}</view>
										<view class="comment-content-box">{{item.content}}<text class="time-box">{{item.create_time}}</text></view>
									</view>
									<view class="right-box">
										<view class="like-img-box" @tap="changeLike(item.id,index,'hot')">
											<image class="like-img" v-if="item.map.is_like==true" src="../../../static/jingjie/hongxin.png"></image>
											<image class="like-img" v-else src="../../../static/jingjie/huixin.png" mode=""></image>
										</view>
										<view class="like-num">{{item.like_count}}</view>
									</view>

								</view>
							</view>
							<view class="more-right1" @tap="huifucomment(item.id,item.map.userinfo.nick_name,item.map.userinfo.user_id,'hot',index)">回复</view>
							<view class="two-level-comment" v-if="item.map.subComment&&item.map.subComment.length>0" @tap="huifucomment(item.id,item.map.subComment[0].map.userinfo.nick_name,item.map.subComment[0].map.userinfo.user_id,'hot',index)">
								<image class="two-user-img" :src="item.map.subComment[0].map.userinfo.avatar"></image>
								<view class="comment-box-big">
									<view class="left-box">
										<view class="user-nickName">{{item.map.subComment[0].map.userinfo.nick_name}} 回复
											{{item.map.subComment[0].map.replyinfo.nick_name}}</view>
										<view class="comment-content-box">{{item.map.subComment[0].content}}<text class="time-box">{{item.map.subComment[0].create_time}}</text></view>
									</view>
									<view class="right-box">
										<view class="like-img-box" @tap="twochangeLike(item.map.subComment[0].id,index,'hotchild')">
											<image v-if="item.map.subComment[0].map.is_like==false" class="like-img" src="../../../static/jingjie/huixin.png"></image>
											<image v-else class="like-img" src="../../../static/jingjie/hongxin.png"></image>
										</view>
										<view class="like-num">{{item.map.subComment[0].like_count}}</view>
									</view>
								</view>

							</view>
							<view class="chakan-more">
								<view class="more-left" @tap="toTwoComment(item.id)" v-if="item.map.subComment&&item.map.subComment.length!=0">
									<view class="more-right">查看{{item.map.subcount}}条对话</view>
									<image src="../../../static/jingjie/youjiantou.png"></image>
								</view>
							</view>
						</view>
					</view>
					<view class="more-box" @tap="moreComment('hot')">
						<text>查看更多</text>
						<image src="../../../static/jingjie/youjiantou.png"></image>
					</view>
				</view>
			</view>
			<!--最新评论-->
			<view class="comment-box">
				<view class="comment">
					<view class="hot-comment">最新评论
						<text class="comment_count">({{comment_count}})</text>
					</view>
					<scroll-view class="scrllBox" scroll-y="true" v-if="nullComment==false">
						<view class="comment-conent-box yi" v-for="(item,index) in commentList" :key="index">
							<view class="first-level-comment">
								<image class="user-img" :src="item.map.userinfo.avatar"></image>
								<view class="comment-box-big">
									<view class="left-box">
										<view class="user-nickName">{{item.map.userinfo.nick_name}}</view>
										<view class="comment-content-box">{{item.content}}<text class="time-box">{{item.create_time}}</text></view>
									</view>
									<view class="right-box">
										<view class="like-img-box" @tap="changeLike(item.id,index,'new')">
											<image v-if="item.map.is_like==true" class="like-img" src="../../../static/jingjie/hongxin.png"></image>
											<image v-else class="like-img" src="../../../static/jingjie/huixin.png"></image>
										</view>
										<view class="like-num">{{item.like_count}}</view>
									</view>

								</view>
							</view>
							<view class="more-right1" @tap="huifucomment(item.id,item.map.userinfo.nick_name,item.map.userinfo.user_id,'new',index)">回复</view>
							<view class="two-level-comment" v-if="item.map.subComment&&item.map.subComment.length>0" @tap="huifucomment(item.id,item.map.subComment[0].map.userinfo.nick_name,item.map.subComment[0].map.userinfo.user_id,'new',index)">

								<image class="two-user-img" :src="item.map.subComment[0].map.userinfo.avatar"></image>
								<view class="comment-box-big">
									<view class="left-box">
										<view class="user-nickName">{{item.map.subComment[0].map.userinfo.nick_name}} 回复
											{{item.map.subComment[0].map.replyinfo.nick_name}}
										</view>
										<!-- <view class="" v-if="item.map.subComment[0].map.replyinfo.nick_name!=''" v-model="item.map.subComment[0].map.replyinfo.nick_name">

										</view> -->
										<view class="comment-content-box">{{item.map.subComment[0].content}}<text class="time-box">{{item.map.subComment[0].create_time}}</text></view>
									</view>
									<view class="right-box">
										<view class="like-img-box" @tap.stop="twochangeLike(item.map.subComment[0].id,index,'newchild')">
											<image v-if="item.map.subComment[0].map.is_like==false" class="like-img" src="../../../static/jingjie/huixin.png"></image>
											<image v-else class="like-img" src="../../../static/jingjie/hongxin.png"></image>
										</view>
										<view class="like-num">{{item.map.subComment[0].like_count}}</view>
									</view>
								</view>

							</view>
							<view class="chakan-more" @tap="toTwoComment(item.id,item.user_id)" v-if="item.map.subComment&&item.map.subComment.length!=0">
								<view class="more-left">
									<!-- @tap="toMoreComment()" -->
									<view class="more-right close">查看{{item.map.subcount}}条对话</view>
									<image src="../../../static/jingjie/youjiantou.png"></image>
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="wupinglun" v-else>
						暂无评论
					</view>

				</view>
			</view>
		</view>



		<!--展示一级评论-->
		<view class="comment-alert-box" v-if="isComment">
			<view class="comment-title-box common">
				<view></view>
				<view class="title">{{commentUserDatail.subcount}}条对话</view>
				<image src="../../../static/jingjie/delete_h.png" @tap="closeComment()"></image>
			</view>
			<!--评论内容-->
			<view>
				<view class="comment-conent-box">
					<view class="first-level-comment">
						<image class="user-img" :src="commentUserDatails.avatar"></image>
						<view class="comment-box-big">
							<view class="left-box">
								<view class="user-nickName">{{commentUserDatails.nick_name}}</view>
								<view class="comment-content-box">{{commentDatail.content}}</view>
							</view>
							<view class="right-box">
								<view class="like-img-box" @tap="changeLike(commentDatail.id,0,'all')">
									<image class="like-img" v-if="commentUserDatail.is_like" src="../../../static/jingjie/hongxin.png"></image>
									<image v-else class="like-img" src="../../../static/jingjie/huixin.png"></image>
								</view>
								<view class="like-num">{{commentDatail.like_count}}</view>
							</view>
						</view>
					</view>
					<view class="chakan-more two">
						<view class="more-left style" @tap="huifucomment(commentDatail.id,commentUserDatails.nick_name,commentUserDatails.user_id,'del')">回复</view>
						<view class="more-right time-box">{{commentDatail.create_time}}</view>
					</view>
					<!--二级评论-->
					<scroll-view class="allComment" scroll-y>
						<view class="two-level-comment" v-for="(item2,index2) in subDatailList" :key="index2" @tap="huifucomment(commentDatail.id,item2.map.userinfo.nick_name,item2.map.userinfo.user_id,'del')">
							<image class="two-user-img" :src="item2.map.userinfo.avatar"></image>
							<view class="comment-box-big clearFlex">
								<view class="common">
									<view class="left-box">
										<view class="user-nickName">{{item2.map.userinfo.nick_name}}
											<text>回复</text>
											{{item2.map.replyinfo.nick_name}}
										</view>
										<!-- <view class="" v-if="item2.map.replyInfo.nick_name">
										
									</view> -->
										<view class="comment-content-box">{{item2.content}}<text class="time-box">{{item2.create_time}}</text></view>
									</view>
									<view class="right-box">
										<view class="like-img-box" @tap.stop="twochangeLike(item2.id,index2,'allchild')">
											<image class="like-img" v-if="item2.map.is_like==true" src="../../../static/jingjie/hongxin.png"></image>
											<image v-else class="like-img" src="../../../static/jingjie/huixin.png"></image>
										</view>
										<view class="like-num">{{item2.like_count}}</view>
									</view>
								</view>
								<view class="twoComment common">
									<view class="huifu">回复</view>
									<view class="remove" v-show="isMe" @tap="deletComment">删除</view>
								</view>
							</view>
						</view>
					</scroll-view>

				</view>
				<view class="border-box"></view>
			</view>
		</view>

		<view class="input-box common" v-if="isDisplay">
			<!-- <input @tap="firstComment" class="inputBox" type="text" placeholder="有爱评论，说点好听的~" /> -->
			<view class="inputBox" @tap="firstComment">
				有爱评论，说点好听的~
			</view>
			<view class="common" @tap="changeshoucang">
				<image class="smilingFace" src="../../../static/jingjie/shoucang.png"></image>
				<view class="shuliang">{{collect_count}}</view>
			</view>
			<!-- #ifdef APP-PLUS -->
			<view class="common">
				<image class="smilingFace" src="../../../static/jingjie/share.png"></image>
				<view class="shuliang">{{share_count}}</view>
			</view>
			<!-- #endif -->
			<!-- #ifdef MP-WEIXIN -->
			<view class="common">
				<button open-type="share" plain="true" style=" width:23px; height:23px;border: none; background-clip: padding-box;" @tap="onShareAppMessage">
					<image class="shareImg" src="/static/jingjie/share.png"></image>
				</button>
				<text class="shuliang">{{share_count}}</text>
			</view>
			<!-- #endif -->
			
		</view>
		<mask :isShowMask='isShowMask' @closeMask='closeComment'></mask>
		<keyFrame @toComment="toComment" :isShow="iskeyFrame" @loseFocus="loseFocus" :focusState="focusState" :huifuname="huifuname"></keyFrame>
	</view>
</template>

<script>
	import mask from '../../../components/mask.vue'
	import keyFrame from '../../../components/keyFrame.vue'
	export default {
		components: {
			mask,
			keyFrame
		},
		data() {
			return {
				isDisplay: true,
				isComment: false, //是否显示评论弹框
				isShowMask: false,
				iskeyFrame: false,
				id: '', //回应id或动态id
				detailsData: {},
				user: '', //用户信息
				time: '',
				like: '', //是否点赞
				collect: '', //是否收藏
				collect_count: '', //收藏数
				share_count: '', //分享数
				comment_count: '', //评论数
				oper_id: uni.getStorageSync('user_id'),
				user_id: '',
				nullComment: true,
				commentList: [],
				twoComment: [], //二级评论
				twoCommentList: [], //二级评论列表
				hotCommentList: [], //热门评论
				commentDatail: {}, //评论详情
				commentUserDatail: {}, //评论用户
				commentUserDatails: {},
				subDatailList: [], //二级详情
				ischild: false, //判断回复是否是二级评论
				reply_id: '',
				parent_id: '', //评论父id
				likeComment: false,
				commentId: '', //回复的id
				huifuname: '', //回复用户名字
				isdongtai: false, //判断是否是动态
				dongtaiDetails: [], //动态详情
				comIndex: '', //评论回复处理用
				huifutype: '', //评论回复处理用
			};
		},
		onShow() {
			this.isDisplay = true;

			if (this.isdongtai) {
				this.getdongtaiDetails()
			} else {
				this.getdetails();
			}
			console.log(this.isdongtai)
		},
		onLoad(option) {
			this.id = option.id;
		},
		onShareAppMessage(){
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: '分享',
				path: '/pages/test/test?id=123'
			}
		},
		methods: {
			toUserDetail(id){
				uni.navigateTo({
					url:'/pages/My/myDetails/myDetails?user_id='+id
				})
			},
			closeComment() {
				this.isComment = false;
				this.isShowMask = false;
				this.ischild = false;
			},
			toComment(content) {
				var me = this;
				if (this.isdongtai) {
					this.isDisplay = true;
					var data = {
						content: content,
						user_id: me.oper_id,
						note_id: me.viewpoint_id,
					}
					this.myAjaxNewPost({
						model: 'message',
						controllerName: 'noteComment',
						actionName: 'insert',
						data: data,
						successBack: function(res) {
							console.log(res)
						}
					})
				} else {
					if (this.ischild) {
						this.iskeyFrame = true
						var data = {
							content: content,
							user_id: me.oper_id,
							parent_id: me.parent_id,
							viewpoint_id: me.id,
							is_reply: true,
							reply_id: this.reply_id,
						}
					} else {
						this.isDisplay = true;
						var data = {
							content: content,
							user_id: me.oper_id,
							viewpoint_id: me.viewpoint_id,
						}
					}
					this.myAjaxNewPost({
						model: 'news',
						controllerName: 'curiositycomment',
						actionName: 'insert',
						data: data,
						successBack: function(res) {
							var time = new Date();
							console.log(res, '回复');
							var currentTime = me.timeProcessing.formatDate(time);
							if (res.data.message == '成功') { //这一步是将评论的内容即时显示，不需要刷新页面
								var comment = {
									map: {
										userinfo: {
											avatar: uni.getStorageSync('avatar'),
											nick_name: uni.getStorageSync('nick_name'),
										},
										replyinfo: {
											nick_name: me.huifuname
										},
										is_like: false
									},
									content: this.data.content,
									create_time: currentTime,
									like_count: 0,

								};
								if (me.ischild == true) { //二级评论
									if (me.huifutype == 'hot') {
										me.hotCommentList[me.comIndex].map.subComment.splice(0, 0, comment)
									} else if (me.huifutype == 'new') {
										me.commentList[me.comIndex].map.subComment.splice(0, 0, comment)
									} else if (me.huifutype == 'del') {
										me.subDatailList.splice(0, 0, comment)
									}
								} else {
									me.nullComment = false;
									me.commentList.splice(0, 0, comment)
									console.log('添加评论')
								}
							}
						}
					})
				}
				content = '';
			},
			huifucomment(id, name, reply_id, type, index) { //点击
				this.iskeyFrame = true;
				this.parent_id = id;
				this.huifuname = name;
				this.reply_id = reply_id;
				this.ischild = true;
				this.comIndex = index;
				this.huifutype = type;
			},
			moreComment(type) {
				this.isComment = true;
				if (type == 'hot') {

				}
				// 				var me =this;
				// 				var data={
				// 					parent_id:id,
				// 					content:content,
				// 					user_id: me.oper_id,
				// 					viewpoint_id: me.viewpoint_id,
				// 				}
				// 				this.myAjaxNewPost({
				// 					model: 'news',
				// 					controllerName: 'curiositycomment',
				// 					actionName: 'insert',
				// 					data: data,
				// 					successBack: function(res) {
				// 						console.log(res);
				// 					}
				// 				})
			},
			// 			setComment(content, type, id) { //评论
			// 				var me = this;
			// 				if (type == 'child') {
			// 					var data = {
			// 						content: content,
			// 						user_id: me.oper_id,
			// 						parent_id: id,
			// 						viewpoint_id: me.viewpoint_id,
			// 					}
			// 				} else {
			// 					var data = {
			// 						content: content,
			// 						user_id: me.oper_id,
			// 						viewpoint_id: me.viewpoint_id,
			// 					}
			// 				}
			// 				this.myAjaxNewPost({
			// 					model: 'news',
			// 					controllerName: 'curiositycomment',
			// 					actionName: 'insert',
			// 					data: data,
			// 					successBack: function(res) {
			// 						var time = new Date();
			// 						console.log(res)
			// 						var currentTime = me.timeProcessing.formatDate(time);
			// 						if (res) { //这一步是将评论的内容即时显示，不需要刷新页面
			// 							var comment = {
			// 								map:{
			// 									userInfo:{
			// 										avatar:uni.getStorageSync('avatar'),
			// 										nick_name: uni.getStorageSync('nick_name'),
			// 									}
			// 								},
			// 								content: content,
			// 								create_time: currentTime,
			// 							};
			// 							if (type === 'child') { //二级评论
			// 								me.twoCommentList.splice(0, 0, comment)
			// 							} else {
			// 								me.commentList.splice(0, 0, comment)
			// 							}
			// 						}
			// 					}
			// 				})
			// 			},
			back() { //返回
				uni.navigateBack({
					delta: 1
				})
			},
			firstComment() {
				this.isDisplay=false
				this.iskeyFrame = true
			},
			toTwoComment(id, user_id) {
				this.isDisplay=false
				this.iskeyFrame = true;
				this.isComment = true;
				this.isShowMask = true;
				this.ischild = true;
				this.commentId = id;
				this.reply_id = user_id;
				this.parent_id = id;
				var me = this;
				var data = {
					id: id,
					oper_id: me.oper_id,
				}
				this.myAjaxNew({
					model: 'news',
					controllerName: 'curiositycomment',
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						me.commentDatail = res.data.data[0];
						console.log(me.commentDatail, '详情评论')
						// me.commentDatail.map.userInfo = JSON.parse(me.commentDatail.map.userInfo);
						// me.commentDatail.create_time = me.commentDatail.create_time.substring(0, 10)
						me.commentDatail.create_time = me.myDate.getDateDiff(me.commentDatail.create_time);
						me.subDatailList = res.data.data[0].map.subComment;
						me.commentUserDatail = me.commentDatail.map;
						me.commentUserDatails = me.commentDatail.map.userinfo;
						for (var i = 0; i < me.subDatailList.length; i++) {
							// me.subDatailList[i].create_time = me.subDatailList[i].create_time.substring(0, 10);
							me.subDatailList[i].create_time = me.myDate.getDateDiff(me.subDatailList[i].create_time);
							console.log(me.commentUserDatails);
							console.log(me.subDatailList, '二级详情');
						}
					}
				})
			},
			loseFocus() {
				this.isDisplay=true
				this.iskeyFrame = false
			},
			changeLike(id, index, type) { //评论点赞
				console.log(11111)
				var me = this;
				var data = {
					history_id: id,
					user_id: me.oper_id,
					operation_type: 'like',
					history_type: 'curiosityviewpointcomment'
				}
				if (type == 'new') {
					if (this.commentList[index].map.is_like == false) {
						this.commentList[index].map.is_like = true
						this.commentList[index].like_count++
					} else {
						this.commentList[index].map.is_like = false;
						this.commentList[index].like_count--;
						if (this.commentList[index].like_count < 0) {
							this.commentList[index].like_count = 0
						}
					}
				}
				if (type == 'hot') {
					if (this.hotCommentList[index].map.is_like == false) {
						this.hotCommentList[index].map.is_like = true
						this.hotCommentList[index].like_count++
					} else {
						this.hotCommentList[index].map.is_like = false;
						this.hotCommentList[index].like_count--;
						if (this.hotCommentList[index].like_count < 0) {
							this.hotCommentList[index].like_count = 0
						}
					}
				}
				if (type == 'all') {
					if (this.commentDatail.map.is_like == false) {
						this.commentDatail.map.is_like = true
						this.commentDatail.like_count++
					} else {
						this.commentDatail.map.is_like = false;
						this.commentDatail.like_count--;
						if (this.commentDatail.like_count < 0) {
							this.commentDatail.like_count = 0
						}
					}
				}
				this.myAjaxNewPost({
					model: 'news',
					controllerName: 'history',
					actionName: 'insert',
					data: data,
					successBack: function(res) {
						console.log(res);
					}
				})
			},
			twochangeLike(id, index, type) { //二级评论点赞
				var me = this;
				var data = {
					history_id: id,
					user_id: me.oper_id,
					operation_type: 'like',
					history_type: 'curiosityviewpointcomment'
				}
				if (type == 'newchild') {
					if (this.commentList[index].map.subComment[0].map.is_like == false) {
						this.commentList[index].map.subComment[0].map.is_like = true
						this.commentList[index].map.subComment[0].like_count++
					} else {
						this.commentList[index].map.subComment[0].map.is_like = false;
						this.commentList[index].map.subComment[0].like_count--;
						if (this.commentList[index].map.subComment[0].like_count < 0) {
							this.commentList[index].map.subComment[0].like_count = 0
						}
					}
				}
				if (type == 'hotchild') {
					if (this.hotCommentList[index].map.subComment[0].map.is_like == false) {
						this.hotCommentList[index].map.subComment[0].map.is_like = true
						this.hotCommentList[index].map.subComment[0].like_count++
					} else {
						this.hotCommentList[index].map.subComment[0].map.is_like = false;
						this.hotCommentList[index].map.subComment[0].like_count--;
						if (this.hotCommentList[index].map.subComment[0].like_count < 0) {
							this.hotCommentList[index].map.subComment[0].like_count = 0
						}
					}
				}
				if (type == 'allchild') {
					if (this.subDatailList[index].map.is_like == false) {
						this.subDatailList[index].map.is_like = true
						this.subDatailList[index].like_count++
					} else {
						this.subDatailList[index].map.is_like = false
						this.subDatailList[index].like_count--
						if (this.subDatailList[index].like_count < 0) {
							this.subDatailList[index].like_count = 0
						}
					}
				}
				this.myAjaxNewPost({
					model: 'news',
					controllerName: 'history',
					actionName: 'insert',
					data: data,
					successBack: function(res) {
						console.log(res);
					}
				})
			},
			getdongtaiDetails() { //获取动态详情
				var me = this;
				var data = {
					id: me.id
				}
				this.myAjaxNew({
					model: 'message',
					controllerName: "noteUser",
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						console.log(res, '动态详情')
						me.dongtaiDetails = res.data.data[0]
						me.user = me.dongtaiDetails.map.userinfo //用户信息
						me.like = me.dongtaiDetails.map.is_like; //是否点赞
						me.collect_count = me.dongtaiDetails.collect_count;
						me.share_count = me.dongtaiDetails.share_count; //分享数
						me.comment_count = me.dongtaiDetails.comment_count; //总评论数
						me.time = me.dongtaiDetails.create_time.substring(0, 10);
						me.user_id = me.dongtaiDetails.user_id;
						me.viewpoint_id = me.dongtaiDetails.id;
						me.getdongtaiCommentList()
					}
				})

			},
			getdongtaiCommentList() {
				var me = this;
				var data = {
					note_id: this.viewpoint_id,
				}
				this.myAjaxNew({
					model: 'message',
					controllerName: "noteComment",
					actionName: 'queryListPage',
					data: data,
					successBack: function(res) {
						console.log(res, '动态评论')

						if (res.data.data != '') {
							me.commentList = res.data.data
						} else {
							me.nullComment = true
						}
					}
				})
			},
			getdetails() { //获取详情
				var me = this;
				var data = {
					id: me.id,
					oper_id: me.oper_id,
				};
				this.myAjaxNew({
					model: 'news',
					controllerName: 'curiosityViewpoint',
					actionName: 'query',
					data: data,
					successBack: function(res) {
						console.log(res)
						var imgArr = [];
						var previewImg = []; //用于预览图片
						// 						res.data.pushtime = me.myDate.getDateDiff(res.data.data[0].pushtime) //处理时间显示（两天前或一小时前）
						// 						for (var i = 0; i < res.data.data[0].comments.length; i++) {
						// 							res.data.data[0].comments[i].commentime = me.myDate.getDateDiff(res.data.data[0].comments[i].commentime) //处理时间显示（两天前或一小时前）
						// 						}
						for (var i = 0; i < res.data.data[0].picStrings.length; i++) {
							if (res.data.data[0].picStrings[i] != null && res.data.data[0].picStrings[i].indexOf('http') != '-1') {
								// res.data.data[0].picStrings[i] = res.data.data[0].picStrings[i].replace('200_200', '720_720') //处理图片清晰度
								var content = {
									imgName: res.data.data[0].picStrings[i]
								}
							} else {
								var content = {
									content: res.data.data[0].picStrings[i]
								}
							}
							imgArr.push(content)
						}
						res.data.data[0].imgArr = imgArr
						for (var i = 0; i < res.data.data[0].imgArr.length; i++) { //预览图片处理
							if (res.data.data[0].imgArr[i].imgName) {
								previewImg.push(res.data.data[0].imgArr[i].imgName)
							}
						}
						res.data.data[0].previewImg = previewImg
						me.detailsData = res.data.data[0];
						// me.covercontent = me.detailData.covercontent;
						me.collect = me.detailsData.map.is_collect; //是否收藏
						me.like = me.detailsData.map.is_like; //是否点赞
						me.collect_count = me.detailsData.collect_count;
						me.share_count = me.detailsData.share_count; //分享数
						me.comment_count = me.detailsData.comment_count; //总评论数
						//me.commentEntities = me.detailsData.map.commentList; //评论列表
						me.user = me.detailsData.map.userinfo; //用户信息
						me.time = me.detailsData.create_time.substring(0, 10);
						me.user_id = me.detailsData.user_id;
						me.viewpoint_id = me.detailsData.id;
						if (me.detailsData.map.commentList == '') {
							me.nullComment = true
						} else {
							me.nullComment = false;
							me.commentList = me.detailsData.map.commentList
							for (var i = 0; i < me.commentList.length; i++) {
								me.commentList[i].create_time = me.myDate.getDateDiff(me.commentList[i].create_time)
								if (me.commentList[i].map.subComment != '') {
									for (var j = 0; j < me.commentList[i].map.subComment.length; j++) {

										me.commentList[i].map.subComment[j].create_time = me.myDate.getDateDiff(me.commentList[i].map.subComment[j]
											.create_time)
									}
								}
							}
						}
						console.log(res.data.data[0]);
						console.log(me.commentList, '最新评论')

					}
				})
				this.getHotComment();
			},
			imgError(index) {
				this.detailsData.imgArr[index] = 'http://www.huihejituan.com/tripPictstorage/default/logo.png';
			},

			getHotComment() {
				var me = this;
				var data = {
					oper_id: me.oper_id,
					viewpoint_id: me.id, //回应id
					parent_id: 0,
					pageSize: 2,
				};
				this.myAjaxNew({
					model: 'news',
					controllerName: 'curiositycomment',
					actionName: 'queryHotCommentListPage',
					data: data,
					successBack: function(res) {
						if (res.data.data == null) {
							me.nullComment = true
						} else {
							for (var i = 0; i < res.data.data.length; i++) {
								res.data.data[i].create_time = me.myDate.getDateDiff(res.data.data[i].create_time)
								if (res.data.data[i].map.subComment != '') {
									for (var j = 0; j < res.data.data[i].map.subComment.length; j++) {
										if (res.data.data[i].map.subComment[j].map.userinfo && res.data.data[i].map.subComment[j].map.userinfo !=
											'') {

											res.data.data[i].map.subComment[j].create_time = me.myDate.getDateDiff(res.data.data[i].map.subComment[j]
												.create_time)
										}

									}
								}
							}
							me.hotCommentList = res.data.data
							// me.likeComment = res.data.data.map.is_like
							console.log(me.hotCommentList, '最热评论')
						}
					},
				})
			},
			changedianzan() {
				console.log(this.user);
				if (this.oper_id == this.user_id) {
					uni.showToast({
						title: '不能为自己点赞',
						icon: 'none'
					})
				} else {
					if (this.like == false) {
						this.like = true;
						this.detailsData.like_count++;
						console.log(this.like);
						var data = {
							user_id: this.oper_id,
							history_type: 'curiosityviewpoint',
							operation_type: 'like',
							history_id: this.detailsData.id,
						};
						this.myAjaxNewPost({
							model: 'news',
							controllerName: 'history',
							actionName: 'insert',
							data: data,
							successBack: function(res) {
								console.log(res);
								uni.showToast({
									title: '已点赞',
									icon: 'none'
								})
							}
						})
					} else {
						this.like = false;
						this.detailsData.like_count--;
						if (this.detailsData.like_count < 0) {
							this.detailsData.like_count = 0
						}
						console.log(this.detailsData.like_count)
						var data = {
							user_id: this.oper_id,
							history_type: 'curiosityviewpoint',
							operation_type: 'like',
							history_id: this.detailsData.id,
						};
						this.myAjaxNewPost({
							model: 'news',
							controllerName: 'history',
							actionName: 'insert',
							data: data,
							successBack: function(res) {
								console.log(res);
								uni.showToast({
									title: '已取消点赞',
									icon: 'none'
								})
							}
						})
					}
				}
			},
			changeshoucang() {
				if (this.oper_id == this.user_id) {
					uni.showToast({
						title: '不能收藏自己的回应',
						icon: 'none'
					})
				} else {
					if (this.collect == false) {
						this.collect = true;
						this.collect_count++;
						var data = {
							user_id: uni.getStorageSync('user_id'),
							history_type: 'curiosityviewpointcollect',
							operation_type: 'collect',
							history_id: this.id,
						};
						this.myAjaxNewPost({
							model: 'news',
							controllerName: 'history',
							actionName: 'insert',
							data: data,
							successBack: function(res) {
								console.log(res);
								uni.showToast({
									title: '已收藏',
									icon: 'none'
								})
							}
						})
					} else {
						this.collect = false;
						this.collect_count--;
						if (this.collect_count < 0) {
							this.collect_count = 0
						}
						var data = {
							user_id: uni.getStorageSync('user_id'),
							history_type: 'curiosityviewpointcollect',
							operation_type: 'collect',
							history_id: this.id,
						};
						this.myAjaxNewPost({
							model: 'news',
							controllerName: 'history',
							actionName: 'insert',
							data: data,
							successBack: function(res) {
								console.log(res);
								uni.showToast({
									title: '已取消收藏',
									icon: 'none'
								})
							}
						})
					}
				}
			},
		}
	}
</script>

<style scoped>
	.conent-box {
		height: 100%;
	}

	.head-box-back {
		width: 100%;
		height: 128upx;
		background: white;
		padding: 0 24upx;
		box-sizing: border-box;
		position: fixed;
		z-index: 999;
		display: flex;
		align-items: center;
	}

	.return-title {
		color: rgba(102, 102, 102, 1);
		font-size: 32upx;
		margin-left: 12upx;
	}

	.conent-big-box {
		position: relative;
		z-index: 888;
		top: 128upx;
	}

	.margin-box {
		margin-top: 40upx;
	}

	.head-box-back image {
		width: 21upx;
		height: 36upx;
	}

	.one-box {
		height: auto;
		/* background: rgba(28, 28, 35, 1); */
		margin-bottom: 20upx;
		position: relative;
		z-index: 888;
	}

	.head-box {
		width: 100%;
		padding: 0 24upx;
		font-size: 38upx;
		color: rgba(51, 51, 51, 1);
		padding-top: 45upx;
		font-weight: bold;
		box-sizing: border-box;
	}

	.user-box {
		width: 100%;
		display: flex;
		align-items: center;
		padding: 0 24upx;
		padding-top: 25upx;
		box-sizing: border-box;
	}

	.from-box {
		margin-top: 25upx;
		padding: 0 24upx;
		box-sizing: border-box;
	}

	.from-box-title {
		color: rgba(70, 206, 207, 1);
		font-size: 24upx;
		border-bottom: 1upx solid rgba(70, 206, 207, 1);
	}

	.user-img-box {
		width: 68upx;
		height: 68upx;
	}

	.like-big-box {
		width: 100%;
		padding: 0 24upx;
		box-sizing: border-box;
		margin-top: 40upx;
	}

	.like-box {
		width: 282upx;
		height: 78upx;
		background: rgba(245, 245, 245, 1);
		border: 1upx solid rgba(204, 204, 204, 1);
		border-radius: 39upx;
		display: flex;
		justify-content: center;
		align-items: center;
		margin: auto;
	}

	.like-box image {
		width: 44upx;
		height: 44upx;
	}

	.like-num-bottom {
		color: rgba(102, 102, 102, 1);
		font-size: 28upx;
		margin-left: 12upx;
	}

	.bianju {
		margin-bottom: 100upx;
	}

	.comment-box-big {
		width: 618upx;
		display: flex;
		justify-content: space-between;
		margin-left: 17upx;
		box-sizing: border-box;
	}

	.user-img-box image {
		width: 100%;
		height: 100%;
		border-radius: 100%;
	}

	.user_new-box {
		margin-left: 15upx;
	}

	.user_nickName {
		font-size: 20upx;
		color: rgba(102, 102, 102, 1);
	}

	.money {
		font-size: 20upx;
		color: rgba(102, 102, 102, 1);
	}

	.describe-big-box {
		width: 100%;
		padding: 0 24upx;
		box-sizing: border-box;
	}

	.describe-wenzi {
		padding-top: 25upx;
		/* padding-bottom: 30upx; */
		color: rgba(51, 51, 51, 1);
		font-size: 32upx;
		line-height: 50upx;
	}

	.describe-img {
		width: 700upx;
		height: 500upx;
		margin-top: 25upx;
		/* margin-bottom: 40upx; */
	}

	/* 	.comment-big-box {
		border-top: 1upx solid rgba(93, 93, 93, 1);
		padding: 0 24upx;
		box-sizing: border-box;
	} */

	.comment-box {
		width: 100%;
		height: auto;
		padding: 0 24upx;
		border-top: 1upx solid rgba(230, 230, 230, 1);
		margin-top: 30upx;
		box-sizing: border-box;
	}

	.comment {
		width: 100%;
		padding-top: 29upx;
		/* padding-bottom: 41upx; */
	}

	.hot-comment {
		color: rgba(51, 51, 51, 1);
		font-size: 32upx;
		font-weight: bold;
	}

	.hot-comment text {
		color: #999999;
		font-size: 26upx;
		font-weight: 100;
	}

	.scrllBox {
		width: 100%;
		height: 610upx;
	}

	.more-comment {
		display: flex;
		align-items: center;
		margin-top: 20upx;
	}

	.more-font {
		color: rgba(153, 153, 153, 1);
		font-size: 24upx;
	}

	.go-more-img {
		width: 20upx;
		height: 20upx;
		margin-left: 12upx;
	}

	.share-box {
		width: 100%;
		padding-bottom: 27upx;
	}

	.share-box-small {
		padding-left: 210upx;
	}

	.small-box {
		display: flex;
		align-items: center;
	}

	.small-box image {
		width: 44upx;
		height: 44upx;
		margin-right: 16upx;
	}

	.wenzi {
		font-size: 28upx;
		color: rgba(204, 204, 204, 1);
	}

	.dianzan {
		color: #FF344D;
	}

	.more-box {
		display: flex;
		align-items: center;
		margin-top: 20upx;
		margin-bottom: 20upx;
	}

	.more-box text {
		color: #666666;
		font-size: 24upx;
	}

	.more-box image {
		width: 19upx;
		height: 20upx;
		margin-left: 12upx;
	}

	/**评论弹框**/
	.comment-alert-box {
		width: 100%;
		height: 1175upx;
		background: white;
		border-radius: 10upx 10upx 0upx 0upx;
		position: fixed;
		bottom: 0;
		z-index: 2000;
	}

	.comment-title-box {
		padding-bottom: 47upx;
		padding: 28upx 24upx;
		box-sizing: border-box;
	}

	.title {
		font-size: 24upx;
		color: rgba(153, 153, 153, 1);
	}

	.comment-title-box image {
		width: 19upx;
		height: 19upx;
	}

	.comment-conent-box {
		width: 100%;
		padding: 0 24upx;
		box-sizing: border-box;
		z-index: 3000;
	}

	.comment-conent-box.yi {
		padding: 0;
		margin-top: 18upx;
	}

	.first-level-comment {
		display: flex;
	}

	.user-img {
		width: 68upx;
		height: 68upx;
		border-radius: 68upx;
	}

	.left-box {
		max-width: 430upx;
	}

	.user-nickName {
		font-size: 24upx;
		color: rgba(153, 153, 153, 1);
	}

	.user-nickName text {
		margin: 0 20upx;
	}

	.comment-content-box {
		font-size: 26upx;
		color: rgba(51, 51, 51, 1);
	}

	.huifu {
		color: rgba(153, 153, 153, 1);
		font-size: 20upx;
	}

	.remove {
		color: rgba(51, 51, 51, 1);
		font-size: 24upx;
	}

	.border-box {
		width: 100%;
		height: 1upx;
		background: rgba(230, 230, 230, 1);
		margin-top: 20upx;
	}

	.time-box {
		font-size: 20upx;
		margin-left: 20upx;
		color: rgba(153, 153, 153, 1);
	}

	.twoComment {
		width: 100%;
		margin-top: 20upx;
	}

	.like-img-box {
		width: 50upx;
		text-align: center;
	}

	.like-img {
		width: 32upx;
		height: 28upx;
	}

	.like-num {
		width: 50upx;
		text-align: center;
		font-size: 20upx;
		color: rgba(102, 102, 102, 1);
	}

	.two-level-comment {
		width: 620upx;
		display: flex;
		padding-left: 12upx;
		padding-bottom: 20upx;
		margin-left: 68upx;
		margin-top: 20upx;
		padding-top: 15upx;
		background: rgba(230, 230, 230, 1);
		border-radius: 10upx;
	}

	.clearFlex {
		display: block;
	}

	.two-user-img {
		width: 40upx;
		height: 40upx;
		border-radius: 40upx;
	}

	.xiala-big-box {
		display: flex;
		align-items: center;
		margin-left: 17upx;
	}

	.left-box-xiala {
		color: rgba(153, 153, 153, 1);
		font-size: 24upx;
	}

	.xiala {
		width: 18upx;
		height: 8upx;
		margin-left: 10upx;
	}

	.input-box {
		width: 100%;
		height: 88upx;
		background: white;
		position: fixed;
		z-index: 999;
		bottom: 0;
		padding: 0 24upx;
		box-sizing: border-box;
	}

	.inputBox {
		width: 418upx;
		font-size: 26upx;
		color: rgba(153, 153, 153, 1);
		border: 1px solid rgba(204, 204, 204, 1);
		border-radius: 10upx;
		padding-left: 15upx;
		height: 64upx;
		line-height: 64upx;
	}

	.smilingFace {
		width: 45upx;
		height: 45upx;
	}
	.shareImg {
		width: 44upx;
		height: 44upx;
		position: absolute;
		left: 0upx;
		top: 0upx;
	}

	.shuliang {
		color: rgba(51, 51, 51, 1);
		font-size: 20upx;
		margin-left: 5upx;
	}

	.chakan-more {
		width: 620upx;
		display: flex;
		align-items: center;
		padding-left: 12upx;
		padding-bottom: 20upx;
		margin-left: 68upx;
		padding-top: 15upx;
	}

	.chakan-more.two {
		margin-top: 0upx;
		padding-top: 0upx;
		padding-bottom: 0upx;
	}

	.more-left {
		display: flex;
		align-items: center;
	}

	.style {
		color: rgba(51, 51, 51, 1);
		font-size: 24upx;
	}

	.more-left image {
		width: 19upx;
		height: 20upx;
		margin-left: 12upx;
		margin-right: 30upx;
	}

	.more-right {
		color: rgba(102, 102, 102, 1);
		font-size: 24upx;
	}

	.more-right1 {
		margin-left: 86upx;
		font-size: 24upx;
		color: #333333;
	}

	.more-right.close {
		margin-left: 0;
	}

	.wupinglun {
		line-height: 150upx;
		color: #333333;
		font-size: 24upx;
		text-align: center;
	}

	.allComment {
		height: 852upx;
	}
</style>
